import type { BaseResponse } from '@/utils/request';
import { request } from '@/utils/request';
import { RequestEnum } from '@/enums/httpEnum';

export const commonApi = {
  upload: '/sys/upload',
};

/**
 * @description 上传文件
 * @param file FormData
 * @returns
 */
export const uploadFile = (file: FormData) => {
  return request<BaseResponse<API.UploadResult>>({
    url: commonApi.upload,
    method: RequestEnum.POST,
    headers: { 'Content-Type': 'multipart/form-data' },
    data: file,
  });
};
